package reflect;

import reflect.annotations.AutoRunClass;
import reflect.annotations.AutoRunMethod;

/*
使用当前类来测试反射机制
 */
@AutoRunClass
public class Person {
    private  String name="张三";
    private int age=18;


    public Person(){}

    public Person( String name, int age) {

        this.name = name;
        this.age = age;
    }
    @AutoRunMethod(3)
    public void sayHello(){
        System.out.println(name+"hello");
    }
    @AutoRunMethod(5)
    public void sayHi(){
        System.out.println(name+"Hi");
    }
    @AutoRunMethod
    public void watchTV(){
        System.out.println(name+"看电视");
    }
    public void  sing(){
        System.out.println(name+"唱歌");
    }
    public void doSameThing(String something){
        System.out.println(name+"正在做"+something);
    }
    public void doSameThing(String something,int count){
        for (int i=0;i<count;i++){
            System.out.println(name+"正在做"+something+i+"次");
        }
    }

    private void dosome(){
        System.out.println("我是person的私有dosome()");
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
